﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Administracija.master" AutoEventWireup="true" CodeFile="Administracija.aspx.cs" Inherits="Administracija" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <link href="Stilovi/Administracija.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

     <div id="administracijaMeni">

                 <ul class="meni_lista">
                    <li><a href="AdministracijaSlika.aspx">Administracija slika</a></li>
                    <li><a href="AdministracijaClanaka.aspx">Administracija članaka</a></li>
                    <li><a href="AdministracijaDrveca.aspx">Administracija drveća</a></li>
                     <li><a href="AdministracijaRasadnika.aspx">Administracija rasadnika</a></li>
                 </ul>
     </div>
     <h2>Popis administratora</h2>
     <div id="popisAdministratora">
         <asp:SqlDataSource ID="sdsPopisAdministratora" runat="server" 
             ConnectionString="<%$ ConnectionStrings:EnciklopedijaDrvecaConnectionString %>" 
             DeleteCommand="DELETE FROM [Administrator] WHERE [AdministratorID] = @AdministratorID" 
             InsertCommand="INSERT INTO [Administrator] ([username], [password]) VALUES (@username, @password)" 
             SelectCommand="SELECT * FROM [Administrator]" 
             UpdateCommand="UPDATE [Administrator] SET [username] = @username, [password] = @password WHERE [AdministratorID] = @AdministratorID">
             <DeleteParameters>
                 <asp:Parameter Name="AdministratorID" Type="Int32" />
             </DeleteParameters>
             <InsertParameters>
                 <asp:Parameter Name="username" Type="String" />
                 <asp:Parameter Name="password" Type="String" />
             </InsertParameters>
             <UpdateParameters>
                 <asp:Parameter Name="username" Type="String" />
                 <asp:Parameter Name="password" Type="String" />
                 <asp:Parameter Name="AdministratorID" Type="Int32" />
             </UpdateParameters>
         </asp:SqlDataSource>
         <asp:GridView ID="grdPopisAdministratora" runat="server" AllowPaging="True" 
             AllowSorting="True" AutoGenerateColumns="False" BackColor="#000066" 
             DataKeyNames="AdministratorID" DataSourceID="sdsPopisAdministratora" 
             ForeColor="White">
             <AlternatingRowStyle BackColor="#000099" ForeColor="White" />
             <Columns>
                 <asp:CommandField CancelText="Odustani" DeleteText="Briši" EditText="Uredi" 
                     InsertText="Dodaj" NewText="Novo" SelectText="Odaberi" ShowDeleteButton="True" 
                     UpdateText="Potvrdi">
                 <ItemStyle Font-Bold="True" />
                 </asp:CommandField>
                 <asp:BoundField DataField="AdministratorID" HeaderText="Id administratora" 
                     InsertVisible="False" ReadOnly="True" SortExpression="AdministratorID" />
                 <asp:BoundField DataField="username" HeaderText="Username" 
                     SortExpression="username" />
                 <asp:BoundField DataField="password" HeaderText="Password" 
                     SortExpression="password" />
             </Columns>
             <HeaderStyle BackColor="Black" />
         </asp:GridView>
     </div>
     <h2>Dodaj administratora</h2>
     <div id="dodajAdministratora">
         <asp:Label ID="lblKorisnickoIme" runat="server" Text="Korisničko ime :" ClientIDMode="Static" ></asp:Label>
         <div id="txt1Okvir">
            <asp:TextBox CssClass="text1" ID="txtKorisnickoIme" runat="server" ClientIDMode="Static" ValidationGroup="validacija"></asp:TextBox>
         </div>
         
         <br />
         <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
             ErrorMessage="Korisničko ime je obavezno" Font-Bold="True" 
             ValidationGroup="validacija" ControlToValidate="txtKorisnickoIme" 
             ForeColor="Red"></asp:RequiredFieldValidator>
        <br />
         <asp:Label ID="lblSifra" runat="server" Text="Šifra :" ClientIDMode="Static" ></asp:Label>
         <div id="txt2Okvir">
             <asp:TextBox CssClass="text2" ID="txtSifra" runat="server" 
                 ClientIDMode="Static"  ValidationGroup="validacija" TextMode="Password"></asp:TextBox>
         </div>
        
         <br />
          <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
             ErrorMessage="Šifra je obavezna" Font-Bold="True" 
             ValidationGroup="validacija" ControlToValidate="txtKorisnickoIme" 
             ForeColor="Red"></asp:RequiredFieldValidator>
             <br />
         <asp:Button ID="btnDodajAdministratora" runat="server" 
             Text="Dodaj Administratora" ClientIDMode="Static"  ValidationGroup="validacija" 
             onclick="btnDodajAdministratora_Click" />
      <div id="porukaODodavanju" runat="server" class="porukaODodavanju">
     </div>
     </div>
     
</asp:Content>

